<?php
include('general_include.php');
include('/class/json.php');

 
$total_in=0;

/*$Search_from_date_in = $_REQUEST['Search_from_date_in']=='Income From'?'':date("Y-m-d",strtotime($_REQUEST['Search_from_date_in']));
$Search_to_date_in = $_REQUEST['Search_to_date_in']=='Income To'?'':date("Y-m-d",strtotime($_REQUEST['Search_to_date_in']));*/

if($_REQUEST['Search_from_date_in']!='From'){

	$Search_from_date_in = $_REQUEST['Search_from_date_in'];
}
else{

	$Search_from_date_in = '';
}

if($_REQUEST['Search_to_date_in']!='To'){

	$Search_to_date_in = $_REQUEST['Search_to_date_in'];
}
else{

	$Search_to_date_in = '';
}

if(!empty($Search_from_date_in))
{
	 $searchSql =  $searchSql." AND date_added >= '".$_REQUEST['Search_from_date_in']."'";
}

if(!empty($Search_to_date_in))
{
	  $searchSql =  $searchSql." AND date_added <= '".$_REQUEST['Search_to_date_in']."'";
}

$IncomeSql =  "SELECT lesson_price,lesson_commision_admin FROM ".TABLEPREFIX."_lesson Where lesson_status_id=4".$searchSql; 
$Income=$AdminManagerObjAjax->GetRecords("All",$IncomeSql);

for($i=0;$i<count($Income);$i++){
$total_in=number_format(($total_in+($Income[$i]['lesson_price']*($Income[$i]['lesson_commision_admin']/100))), 2, '.', '');			 
}


echo json_encode(

				array(
				
					'IncomeSql'=> $IncomeSql,
					'total_in' => $total_in
				)
			);			

	

?>